﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace YmatouAPI.Test
{
    /// <summary>
    /// Apis配置服务
    /// 目前写死
    /// </summary>
    public class ApiConfigs
    {
        /// <summary>
        /// 
        /// </summary>
        public static List<ApiEntity> ApiEntitys { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        public static Dictionary<string, ApiUtils> ApiDictionarys { get; private set; }
        private ApiConfigs()
        {

        }
        static ApiConfigs()
        {
            Init_Re();

        }
      
        /// <summary>
        /// 更新dll库
        /// </summary>
        /// <param name="dllName"></param>
        public static void Init_Re(string dllName)
        {

        }
        public static void Init_Re()
        {
            Init_Apis();
            Init_AllRequest();
        }
        /// <summary>
        /// 
        /// </summary>
       static void Init_Apis()
        {
            ApiEntitys = new List<ApiEntity>();
            ApiEntitys.Add(new ApiEntity() { ApiName = "商品服务Api", DllName = "Ymatou.Product.API.Model", ApiUrl_Alpha = "http://api.product.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "订单服务Api", DllName = "Ymatou.API.Order.Model", ApiUrl_Alpha = "http://api.order.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "购物车服务Api", DllName = "Ymatou.ShoppingCart.Dto", ApiUrl_Alpha = "http://api.shoppingcart.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "店铺服务Api", DllName = "Ymatou.Shop.API.Contract", ApiUrl_Alpha = "http://api.shop.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "评论服务Api", DllName = "Ymatou.DSRApi.Model", ApiUrl_Alpha = "http://api.dsr.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "营销工具Api", DllName = "Ymatou.Promotion.Api.Model", ApiUrl_Alpha = "http://api.Promotion.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "码头AppApi", DllName = "Ymatou.App.Dto", ApiUrl_Alpha = "http://api.app.alpha.ymatou.com" });
            ApiEntitys.Add(new ApiEntity() { ApiName = "码头BI推荐AppApi", DllName = "YmatouBIProduct.ProductApiModel", ApiUrl_Alpha = "http://t.alpha.ymatou.com" });
            //活动服务
            //ApiEntitys.Add(new ApiEntity() { ApiName = "活动服务ServiceApi", DllName = "Ymatou.App.Dto", ApiUrl_Alpha = "http://serviceapi.activity.alpha.ymatou.com" });
            //ApiEntitys.Add(new ApiEntity() { ApiName = "码头AppApi", DllName = "Ymatou.App.Dto", ApiUrl_Alpha = "http://sellerapi.activity.alpha.ymatou.com" });


       }
       /// <summary>
       /// 
       /// </summary>
       static void Init_AllRequest()
       {
           ApiDictionarys = new Dictionary<string, ApiUtils>();
           foreach (var entity in ApiEntitys)
           {
               ApiDictionarys.Add(entity.DllName.Trim(), new ApiUtils(entity.DllName.Trim()));
           }
       }
    }
}